﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Data.Objects.DataClasses;
using System.Xml.Serialization;

namespace FinalProject.DAL.Model
{
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName = "InvoiceModel", Name = "Voucher")]
    [Serializable()]
    [DataContractAttribute(IsReference = true)]
    public partial class Voucher : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Voucher object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="voucherNumber">Initial value of the VoucherNumber property.</param>
        /// <param name="currencyRate">Initial value of the CurrencyRate property.</param>
        /// <param name="totalAmount">Initial value of the TotalAmount property.</param>
        /// <param name="description">Initial value of the Description property.</param>
        /// <param name="journalId">Initial value of the JournalId property.</param>
        /// <param name="CustomerId">Initial value of the CustomerId property.</param>
        public static Voucher CreateVoucher(global::System.Guid id, global::System.Int64 voucherNumber, global::System.Int32 currencyRate, global::System.Decimal totalAmount, global::System.String description, global::System.Guid journalId, global::System.Guid CustomerId)
        {
            Voucher voucher = new Voucher();
            voucher.Id = id;
            voucher.VoucherNumber = voucherNumber;
            voucher.CurrencyRate = currencyRate;
            voucher.TotalAmount = totalAmount;
            voucher.Description = description;
            voucher.JournalId = journalId;
            voucher.CustomerId = CustomerId;
            return voucher;
        }

        #endregion

        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Int64 VoucherNumber
        {
            get
            {
                return _VoucherNumber;
            }
            set
            {
                OnVoucherNumberChanging(value);
                ReportPropertyChanging("VoucherNumber");
                _VoucherNumber = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("VoucherNumber");
                OnVoucherNumberChanged();
            }
        }
        private global::System.Int64 _VoucherNumber;
        partial void OnVoucherNumberChanging(global::System.Int64 value);
        partial void OnVoucherNumberChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Int32 CurrencyRate
        {
            get
            {
                return _CurrencyRate;
            }
            set
            {
                OnCurrencyRateChanging(value);
                ReportPropertyChanging("CurrencyRate");
                _CurrencyRate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CurrencyRate");
                OnCurrencyRateChanged();
            }
        }
        private global::System.Int32 _CurrencyRate;
        partial void OnCurrencyRateChanging(global::System.Int32 value);
        partial void OnCurrencyRateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Decimal TotalAmount
        {
            get
            {
                return _TotalAmount;
            }
            set
            {
                OnTotalAmountChanging(value);
                ReportPropertyChanging("TotalAmount");
                _TotalAmount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("TotalAmount");
                OnTotalAmountChanged();
            }
        }
        private global::System.Decimal _TotalAmount;
        partial void OnTotalAmountChanging(global::System.Decimal value);
        partial void OnTotalAmountChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid JournalId
        {
            get
            {
                return _JournalId;
            }
            set
            {
                OnJournalIdChanging(value);
                ReportPropertyChanging("JournalId");
                _JournalId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("JournalId");
                OnJournalIdChanged();
            }
        }
        private global::System.Guid _JournalId;
        partial void OnJournalIdChanging(global::System.Guid value);
        partial void OnJournalIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid CustomerId
        {
            get
            {
                return _CustomerId;
            }
            set
            {
                OnCustomerIdChanging(value);
                ReportPropertyChanging("CustomerId");
                _CustomerId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CustomerId");
                OnCustomerIdChanged();
            }
        }
        private global::System.Guid _CustomerId;
        partial void OnCustomerIdChanging(global::System.Guid value);
        partial void OnCustomerIdChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "VoucherCollectionMoney", "CollectionMoney")]
        public EntityCollection<CollectionMoney> CollectionMoneys
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<CollectionMoney>("InvoiceModel.VoucherCollectionMoney", "CollectionMoney");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<CollectionMoney>("InvoiceModel.VoucherCollectionMoney", "CollectionMoney", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "JournalVoucher", "Journal")]
        public Journal Journal
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Journal>("InvoiceModel.JournalVoucher", "Journal").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Journal>("InvoiceModel.JournalVoucher", "Journal").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Journal> JournalReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Journal>("InvoiceModel.JournalVoucher", "Journal");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Journal>("InvoiceModel.JournalVoucher", "Journal", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "CustomerVoucher", "Customer")]
        public Customer Customer
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customer>("InvoiceModel.CustomerVoucher", "Customer").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customer>("InvoiceModel.CustomerVoucher", "Customer").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customer> CustomerReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customer>("InvoiceModel.CustomerVoucher", "Customer");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customer>("InvoiceModel.CustomerVoucher", "Customer", value);
                }
            }
        }

        #endregion
    }


}
